<<template>
  <div style="height:100%">
      <!--表11____县生产信息调查统计表T_MulProdInfoChart-->
      <div class="divSearch" style="padding: 6px;">
            <Row>
                <Col span="24" class="col-margin">
                    填报年度：
                    <Select v-model="searchModel.FillInYear" placeholder="全部" style="width: 100px" @on-change="getPageData()">
                        <Option value="">全部</Option>
                        <Option :value="item.DictValue" v-for="item in CreateYearList" :key="item.DictValue">{{item.DictText}}</Option>
                    </Select>
                    时间周期：
                    <Select v-model="searchModel.TimesType" placeholder="全部" style="width: 100px" @on-change="getPageData()">
                        <Option value="">全部</Option>
                        <Option :value="item.DictValue" v-for="item in CycleList" :key="item.DictValue">{{item.DictText}}</Option>
                    </Select>
                    <Button icon="ios-search" type="ghost" @click="getPageData()" style="margin-left: 5px;background: linear-gradient(to bottom, #64c8ef 0%,#00a2e2 100%);color: #fff;border-radius: 3px;text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.3);">
                        查询
                    </Button>
                </Col>
            </Row>
      </div>
    <Row style="padding:10px;">
        <Col span="24" class="col-margin">
        <Table size="small" :height="clientHeight" border :context="ctx" :columns="columnsList" :data="datas.rows" no-data-text='暂无数据...'></Table>
        </Col>
    </Row>
    <Row>
        <Col span="24" class="dataTable">
        <Page style="float:right;margin: 5px 20px 5px 0;" class="page-style" :total="datas.total" placement="top" @on-change="getPageNumber" :page-size="searchModel.PageSize" :page-size-opts='pageSizeOpts' show-sizer @on-page-size-change="getPageSize" show-total show-elevator></Page>
        </Col>
    </Row>
        <Modal v-model="showType" :mask-closable="false" :closable="true" width="800">
          <p slot="header" class="title">
            <Icon type="ios-paper" size="20"></Icon>
            <span style="font-size: 20px">县生产信息调查填报</span>
          </p>
          <p slot="close">
            <Icon type="close-circled" color="red" size=25></Icon>
          </p>
          <table class="reptable" style="width:100%">
              <tr style="text-align:left;">
                  <th colspan="4">一、乡镇信息调查</th>
              </tr>
              <tr>
                  <td>万亩以上乡（镇）数（个）</td>
                  <td><Input v-model="dataModel.NumTownship"></Input></td>
                  <td>分别是</td>
                  <td><Input v-model="dataModel.NumTownshipName"></Input></td>
              </tr>
              <tr>
                  <td>千亩以上村（委会）（个）</td>
                  <td><Input v-model="dataModel.NumVillage"></Input></td>
                  <td>分别是</td>
                  <td><Input v-model="dataModel.NumVillageName"></Input></td>
              </tr>
              <tr>
                  <td>养蚕户（户）</td>
                  <td colspan="3"><Input v-model="dataModel.MulHouseholds"></Input></td>
              </tr>
              <tr>
                  <td>全年养蚕量 (1)＜3张（户）</td>
                  <td><Input v-model="dataModel.AnnualSilkwormOne"></Input></td>
                  <td>(2)≤5张（户）</td>
                  <td><Input v-model="dataModel.AnnualSilkwormTwo"></Input></td>
              </tr>
              <tr>
                  <td>(3)≤10张（户）</td>
                  <td><Input v-model="dataModel.AnnualSilkwormThree"></Input></td>
                  <td>(4)＞10张（户）</td>
                  <td><Input v-model="dataModel.AnnualSilkwormFour"></Input></td>
              </tr>
              <tr style="text-align:left;">
                  <th colspan="4">二、技术人员信息调查</th>
              </tr>
              <tr>
                  <td>技术人员总数（人）</td>
                  <td><Input v-model="dataModel.TecPersonTotalNum"></Input></td>
                  <td>其中：在职在编</td>
                  <td><Input v-model="dataModel.TecPersonAllInNum"></Input></td>
              </tr>
              <tr>
                  <td>(1) 按性别分:男</td>
                  <td><Input v-model="dataModel.ManNum"></Input></td>
                  <td>女</td>
                  <td><Input v-model="dataModel.WomanNum"></Input></td>
              </tr>
              <tr>
                  <td>(2)按年龄分:≤30岁</td>
                  <td><Input v-model="dataModel.AgeOne"></Input></td>
                  <td>30-40岁</td>
                  <td><Input v-model="dataModel.AgeTwo"></Input></td>
              </tr>
              <tr>
                  <td>40-50岁</td>
                  <td><Input v-model="dataModel.AgeThree"></Input></td>
                  <td>50岁以上</td>
                  <td><Input v-model="dataModel.AgeFour"></Input></td>
              </tr>
              <tr>
                  <td>(3)按学历层次分:硕士及以上</td>
                  <td><Input v-model="dataModel.EduLevelOne"></Input></td>
                  <td>本科</td>
                  <td><Input v-model="dataModel.EduLeveTwo"></Input></td>
              </tr>
              <tr>
                  <td>大专</td>
                  <td><Input v-model="dataModel.EduLevelThree"></Input></td>
                  <td>中专（技校）</td>
                  <td><Input v-model="dataModel.EduLevelFour"></Input></td>
              </tr>
              <tr>
                  <td>职称情况:正高</td>
                  <td><Input v-model="dataModel.TitleOne"></Input></td>
                  <td>副高</td>
                  <td><Input v-model="dataModel.TitleTwo"></Input></td>
              </tr>
              <tr>
                  <td>中职</td>
                  <td><Input v-model="dataModel.TitleThree"></Input></td>
                  <td>初职</td>
                  <td><Input v-model="dataModel.TitleFour"></Input></td>
              </tr>
              <tr style="text-align:left;">
                  <th colspan="4">三、蚕室、蚕具调查</th>
              </tr>
              <tr>
                  <td>蚕种催青室间数（间）</td>
                  <td><Input v-model="dataModel.IncuRoomNum"></Input></td>
                  <td>面积（m2）</td>
                  <td><Input v-model="dataModel.IncuRoomArea"></Input></td>
              </tr>
              <tr>
                  <td>季催青能力（张）</td>
                  <td><Input v-model="dataModel.JiCuiqingPower"></Input></td>
                  <td>年催青（张）</td>
                  <td><Input v-model="dataModel.YearsOfIncu"></Input></td>
              </tr>
              <tr>
                  <td>小蚕共育点（个）</td>
                  <td><Input v-model="dataModel.SilkwormSpots"></Input></td>
                  <td>面积（m2）</td>
                  <td><Input v-model="dataModel.SilkwormArea"></Input></td>
              </tr>
              <tr>
                  <td>季共育能力（张）</td>
                  <td><Input v-model="dataModel.QuaternaryFertility"></Input></td>
                  <td>年共育量（张）</td>
                  <td><Input v-model="dataModel.AnnualTotalFertility"></Input></td>
              </tr>
              <tr>
                  <td>大蚕室间数（间）</td>
                  <td><Input v-model="dataModel.LargeCocoonNum"></Input></td>
                  <td>面积（m2）</td>
                  <td><Input v-model="dataModel.LargeCocoonArea"></Input></td>
              </tr>
              <tr>
                  <td>省力化蚕台（套）</td>
                  <td><Input v-model="dataModel.LaborSavingRearTable"></Input></td>
                  <td>方格簇（张）</td>
                  <td><Input v-model="dataModel.GridCluster"></Input></td>
              </tr>
              <tr>
                  <td>蚕茧收烘站（个）</td>
                  <td><Input v-model="dataModel.CocoonStation"></Input></td>
                  <td>面积（m2）</td>
                  <td><Input v-model="dataModel.CocoonStationArea"></Input></td>
              </tr>
              <tr>
                  <td>季收烘能力（吨）</td>
                  <td><Input v-model="dataModel.SeasonalDryCapacity"></Input></td>
                  <td>循环烘茧机（套）</td>
                  <td><Input v-model="dataModel.CircularDryMachine"></Input></td>
              </tr>
              <tr style="text-align:left;">
                  <th colspan="4">四、相关企业调查</th>
              </tr>
              <tr>
                  <td>(1)缫丝企业（个）</td>
                  <td colspan="3"><Input v-model="dataModel.ReelingEnterprise"></Input></td>
              </tr>
              <tr>
                  <td>其中：缫丝能力≤5组</td>
                  <td><Input v-model="dataModel.ReelingCapacityOne"></Input></td>
                  <td>≤10组</td>
                  <td><Input v-model="dataModel.ReelingCapacityTwo"></Input></td>
              </tr>
              <tr>
                  <td>≤15组</td>
                  <td><Input v-model="dataModel.ReelingCapacityThree"></Input></td>
                  <td>＞15组</td>
                  <td><Input v-model="dataModel.ReelingCapacityFour"></Input></td>
              </tr>
              <tr>
                  <td>(2)蚕种场（个）</td>
                  <td><Input v-model="dataModel.SilkwormField"></Input></td>
                  <td>生产能力（万张）</td>
                  <td><Input v-model="dataModel.ThroughPut"></Input></td>
              </tr>
              <tr>
                  <td>(3)蚕丝被加工企业（个）</td>
                  <td><Input v-model="dataModel.SilkEnterprise"></Input></td>
                  <td>年加工蚕丝被（吨）</td>
                  <td><Input v-model="dataModel.ProcessedSilkQuilt"></Input></td>
              </tr>
              <tr>
                  <td>(4)其它</td>
                  <td><Input v-model="dataModel.Other"></Input></td>
                  <td>生产能力（单位：）</td>
                  <td><Input v-model="dataModel.OtherThroughPut"></Input></td>
              </tr>
          </table>
          <div style="text-align:right;padding-top:10px">
            <Button type="primary" @click="save()">保存</Button>
            <Button type="ghost" @click="cancel()" style="margin-left: 5px">取消</Button>
          </div>
          <div slot="footer">
              <Alert style="margin-top:5px;text-align:left;font-size:14px;" banner type="error">
                  备注：1、“其它”为表格中没有统计的相关蚕桑制品的生产的企业。
                  <br/><br/>2.此表不需要每年都填报，统计信息有变动时重新填报，系统统计按每个县最后一次填报统计。
              </Alert>
          </div>
        </Modal>
        <Modal v-model="ViewShow" :mask-closable="false" width="1000">
            <p slot="header" class="title">
                <Icon type="ios-paper" size="20"></Icon>
                <span style="font-size: 20px">县生产信息调查填报</span>
            </p>
            <p slot="close">
                <Icon type="close-circled" color="red" size=25></Icon>
            </p>
            <table class="reptable" style="width:100%">
              <tr style="text-align:left;">
                  <th colspan="4">一、乡镇信息调查</th>
              </tr>
              <tr style="text-align:right;"> 
                  <td>万亩以上乡（镇）数（个）</td>
                  <td style="text-align:right;width:150px;padding: 4px 7px;">{{dataModel.NumTownship}}</td>
                  <td>分别是</td>
                  <td>{{dataModel.NumTownshipName}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>千亩以上村（委会）（个）</td>
                  <td style="padding: 4px 7px;">{{dataModel.NumVillage}}</td>
                  <td>分别是</td>
                  <td style="padding: 4px 7px;">{{dataModel.NumVillageName}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>养蚕户（户）</td>
                  <td colspan="3" style="padding: 4px 7px;">{{dataModel.MulHouseholds}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>全年养蚕量 (1)＜3张（户）</td>
                  <td style="padding: 4px 7px;">{{dataModel.AnnualSilkwormOne}}</td>
                  <td>(2)≤5张（户）</td>
                  <td style="padding: 4px 7px;" >{{dataModel.AnnualSilkwormTwo}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>(3)≤10张（户）</td>
                  <td style="padding: 4px 7px;">{{dataModel.AnnualSilkwormThree}}</td>
                  <td>(4)＞10张（户）</td>
                  <td style="padding: 4px 7px;">{{dataModel.AnnualSilkwormFour}}</td>
              </tr>
              <tr style="text-align:left;">
                  <th colspan="4">二、技术人员信息调查</th>
              </tr>
              <tr style="text-align:right;">
                  <td>技术人员总数（人）</td>
                  <td style="padding: 4px 7px;">{{dataModel.TecPersonTotalNum}}</td>
                  <td>其中：在职在编</td>
                  <td style="padding: 4px 7px;">{{dataModel.TecPersonAllInNum}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>(1) 按性别分:男</td>
                  <td style="padding: 4px 7px;">{{dataModel.ManNum}}</td>
                  <td>女</td>
                  <td style="padding: 4px 7px;">{{dataModel.WomanNum}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>(2)按年龄分:≤30岁</td>
                  <td style="padding: 4px 7px;">{{dataModel.AgeOne}}</td>
                  <td>30-40岁</td>
                  <td style="padding: 4px 7px;">{{dataModel.AgeTwo}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>40-50岁</td>
                  <td style="padding: 4px 7px;">{{dataModel.AgeThree}}</td>
                  <td>50岁以上</td>
                  <td style="padding: 4px 7px;">{{dataModel.AgeFour}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>(3)按学历层次分:硕士及以上</td>
                  <td style="padding: 4px 7px;">{{dataModel.EduLevelOne}}</td>
                  <td>本科</td>
                  <td style="padding: 4px 7px;">{{dataModel.EduLeveTwo}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>大专</td>
                  <td style="padding: 4px 7px;">{{dataModel.EduLevelThree}}</td>
                  <td>中专（技校）</td>
                  <td style="padding: 4px 7px;">{{dataModel.EduLevelFour}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>职称情况:正高</td>
                  <td style="padding: 4px 7px;">{{dataModel.TitleOne}}</td>
                  <td>副高</td>
                  <td style="padding: 4px 7px;">{{dataModel.TitleTwo}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>中职</td>
                  <td style="padding: 4px 7px;">{{dataModel.TitleThree}}</td>
                  <td>初职</td>
                  <td style="padding: 4px 7px;">{{dataModel.TitleFour}}</td>
              </tr>
              <tr style="text-align:left;">
                  <th colspan="4">三、蚕室、蚕具调查</th>
              </tr>
              <tr style="text-align:right;">
                  <td>蚕种催青室间数（间）</td>
                  <td style="padding: 4px 7px;">{{dataModel.IncuRoomNum}}</td>
                  <td>面积（m2）</td>
                  <td style="padding: 4px 7px;">{{dataModel.IncuRoomArea}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>季催青能力（张）</td>
                  <td style="padding: 4px 7px;">{{dataModel.JiCuiqingPower}}</td>
                  <td>年催青（张）</td>
                  <td style="padding: 4px 7px;">{{dataModel.YearsOfIncu}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>小蚕共育点（个）</td>
                  <td style="padding: 4px 7px;">{{dataModel.SilkwormSpots}}</td>
                  <td>面积（m2）</td>
                  <td style="padding: 4px 7px;">{{dataModel.SilkwormArea}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>季共育能力（张）</td>
                  <td style="padding: 4px 7px;">{{dataModel.QuaternaryFertility}}</td>
                  <td>年共育量（张）</td>
                  <td style="padding: 4px 7px;">{{dataModel.AnnualTotalFertility}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>大蚕室间数（间）</td>
                  <td style="padding: 4px 7px;">{{dataModel.LargeCocoonNum}}</td>
                  <td>面积（m2）</td>
                  <td style="padding: 4px 7px;">{{dataModel.LargeCocoonArea}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>省力化蚕台（套）</td>
                  <td style="padding: 4px 7px;">{{dataModel.LaborSavingRearTable}}</td>
                  <td>方格簇（张）</td>
                  <td style="padding: 4px 7px;">{{dataModel.GridCluster}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>蚕茧收烘站（个）</td>
                  <td style="padding: 4px 7px;">{{dataModel.CocoonStation}}</td>
                  <td>面积（m2）</td>
                  <td style="padding: 4px 7px;">{{dataModel.CocoonStationArea}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>季收烘能力（吨）</td>
                  <td style="padding: 4px 7px;">{{dataModel.SeasonalDryCapacity}}</td>
                  <td>循环烘茧机（套）</td>
                  <td style="padding: 4px 7px;">{{dataModel.CircularDryMachine}}</td>
              </tr>
              <tr style="text-align:left;">
                  <th colspan="4">四、相关企业调查</th>
              </tr>
              <tr style="text-align:right;">
                  <td>(1)缫丝企业（个）</td>
                  <td colspan="3" style="padding: 4px 7px;">{{dataModel.ReelingEnterprise}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>其中：缫丝能力≤5组</td>
                  <td style="padding: 4px 7px;">{{dataModel.ReelingCapacityOne}}</td>
                  <td>≤10组</td>
                  <td style="padding: 4px 7px;">{{dataModel.ReelingCapacityTwo}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>≤15组</td>
                  <td style="padding: 4px 7px;">{{dataModel.ReelingCapacityThree}}</td>
                  <td>＞15组</td>
                  <td style="padding: 4px 7px;">{{dataModel.ReelingCapacityFour}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>(2)蚕种场（个）</td>
                  <td style="padding: 4px 7px;">{{dataModel.SilkwormField}}</td>
                  <td>生产能力（万张）</td>
                  <td style="padding: 4px 7px;">{{dataModel.ThroughPut}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>(3)蚕丝被加工企业（个）</td>
                  <td style="padding: 4px 7px;">{{dataModel.SilkEnterprise}}</td>
                  <td>年加工蚕丝被（吨）</td>
                  <td style="padding: 4px 7px;">{{dataModel.ProcessedSilkQuilt}}</td>
              </tr>
              <tr style="text-align:right;">
                  <td>(4)其它</td>
                  <td style="padding: 4px 7px;">{{dataModel.Other}}</td>
                  <td>生产能力（单位：）</td>
                  <td style="padding: 4px 7px;">{{dataModel.OtherThroughPut}}</td>
              </tr>
          </table>
            <div slot="footer">
                <Alert style="margin-top:5px;text-align:left;font-size:14px;" banner type="error">
                    备注：1、“其它”为表格中没有统计的相关蚕桑制品的生产的企业。
                    <br/><br/>2.此表不需要每年都填报，统计信息有变动时重新填报，系统统计按每个县最后一次填报统计。
                    <span slot="desc">
                    </span>
                </Alert>
            </div>
        </Modal>
  </div>
</template>
<script>
export default {
    data() {
        return {
            datas: {},//table数据对象
            dataIds: [],
            TableCodeList: this.GetGroupDict("ReportTableName"),//表名称
            CreateYearList: this.GetGroupDict("ReportYear"),//上报年份
            CycleList: this.GetGroupDict("ReportCycle"),//周期
            pageSizeOpts: [20, 40, 50],//默认分页最大设置
            showType: false,//编辑框弹出状态
            ViewShow: false,
            selectTabName: '',
            TabTitleList: [],//tab选项卡列表
            //查询模型：根据需求删除不不要查询条件
            searchModel: {
                ReportCode: 'MulProdInfoChart',
                FillInYear: '',
                TimesType: '',
                AreaCode: '',
                PageNumber: 1, PageSize: 20
            },
            dataModel: {//编辑模型
                Id: 0,
                ReportId: '',
                NumTownship: '',
                NumTownshipName: '',
                NumVillage: '',
                NumVillageName: '',
                MulHouseholds: '',
                AnnualSilkwormOne: '',
                AnnualSilkwormTwo: '',
                AnnualSilkwormThree: '',
                AnnualSilkwormFour: '',
                TecPersonTotalNum: '',
                TecPersonAllInNum: '',
                ManNum: '',
                WomanNum: '',
                AgeOne: '',
                AgeTwo: '',
                AgeThree: '',
                AgeFour: '',
                EduLevelOne: '',
                EduLevelTwo: '',
                EduLevelThree: '',
                EduLevelFour: '',
                TitleOne: '',
                TitleTwo: '',
                TitleThree: '',
                TitleFour: '',
                IncuRoomNum: '',
                IncuRoomArea: '',
                JiCuiqingPower: '',
                YearsOfIncu: '',
                SilkwormSpots: '',
                SilkwormArea: '',
                QuaternaryFertility: '',
                AnnualTotalFertility: '',
                LargeCocoonNum: '',
                LargeCocoonArea: '',
                LaborSavingRearTable: '',
                GridCluster: '',
                CocoonStation: '',
                CocoonStationArea: '',
                SeasonalDryCapacity: '',
                CircularDryMachine: '',
                ReelingEnterprise: '',
                ReelingCapacityOne: '',
                ReelingCapacityTwo: '',
                ReelingCapacityThree: '',
                ReelingCapacityFour: '',
                SilkwormField: '',
                ThroughPut: '',
                SilkEnterprise: '',
                ProcessedSilkQuilt: '',
                Other: '',
                OtherThroughPut: ''
            },
            ctx: this,//table数据上下文
            columnsList: [
                { title: "报表名称", key: "ReportName", },
                { title: "填报年度", key: "FillInYearName", },
                { title: "属行政区划", key: "AreaCodeName", },
                { title: "填报时间周期", key: "TimesTypeName", },
                {
                    title: "报表状态", key: "StatusName",
                    render: (h, params) => {
                        switch (params.row.Status * 1) {
                            case 0: //审核未通过
                                return h('span', { class: { Error: true } }, params.row.StatusName);
                            case 1: //未填写
                                return h('span', { class: { NoReport: true } }, params.row.StatusName);
                            case 2: //已填写
                                return h('span', { class: { AlreadyReport: true } }, params.row.StatusName);
                            case 3: //已上报
                                return h('span', { class: { UpReport: true } }, params.row.StatusName);
                            case 4: //审核通过
                                return h('span', { class: { Success: true } }, params.row.StatusName);
                            case 5: //锁定
                                return h('span', { class: { error: true } }, params.row.StatusName);
                            default:
                                return h('span', { class: { Default: true } }, params.row.StatusName);
                        }
                    }
                },
                { title: "新增时间", key: "StrAddTime", },
                { title: "填报时间", key: "StrUpdateTime", },
                {
                    title: "操作", key: "Id", width: 250, align: 'center',
                    render: (h, params) => {
                        return h('div', [
                            h('Button', {
                                class: { ieditColor: true },
                                props: {
                                    type: 'ghost', size: 'small', icon: 'ios-paper-outline'
                                },
                                style: {
                                    marginRight: '5px'
                                },
                                on: {
                                    click: () => {
                                        this.showInfo(params.row.Id, params.row.ReportCode)
                                    }
                                }
                            }, '查看'),
                            h('Button', {
                                class: { irefreshColor: true },
                                props: {
                                    type: 'ghost', size: 'small', icon: 'ios-compose', disabled: params.row.Status > 2
                                },
                                style: {
                                    marginRight: '5px'
                                },
                                on: {
                                    click: () => {
                                        this.editInfo(params.row.Id, params.row.ReportCode)
                                    }
                                }
                            }, '填报'),
                            h('Button', {
                                class: { ieditColor: true },
                                props: {
                                    type: 'ghost', size: 'small', icon: 'upload', disabled: params.row.Status != 2
                                },
                                style: {
                                    marginRight: '5px'
                                },
                                on: {
                                    click: () => {
                                        this.upReport(params.row.Id)
                                    }
                                }
                            }, '上报'),
                        ])
                    }
                }
            ],
            clientHeight: window.innerHeight - 260,//表格默认高度
        }
    },
    mounted() {
        //table高度计算方法
        const that = this;
        window.onresize = () => {
            return (() => {
                that.clientHeight = window.innerHeight - 260;
            })()
        };
    },
    methods: {
        upReport(id) {
            var self = this;
            self.$Modal.confirm({
                title: '提示信息',
                content: '<p>是否确认上报？</p>',
                onOk: () => {
                    var model = new Object();
                    model.Id = id;
                    model.reportType = '3';
                    model.strMsg = '';
                    this.$http.post("Report/PostUpStatus", model).then(
                        function (res) {
                            if (res.data.status == 1) {
                                self.$Notice.success({ title: '已上报！', desc: false });
                                self.getPageData();
                            }
                            else {
                                self.$Modal.error({ title: "提示信息", content: "上报失败!!!" });
                            }
                        }
                    );
                }
            });
        },
        getTab(name) {
            this.selectTabName = name;
        },
        //查看报表
        showInfo(id, reportCode) {
            var self = this;
            this.$http.get("Report", { params: { id: id, reportCode: reportCode } }).then(//获取数据编辑项的值
                function (res) {
                    switch (res.data.list.status) {
                        case 1:
                            //self.initTab(self, res.data.list.model);
                            self.dataModel = res.data.list.model;
                            self.ViewShow = true;
                            break;
                        case 0:
                            self.$Modal.error({ title: "提示信息", content: "编辑数据加载失败!!!" });
                            break;
                        case -1:
                            self.$Modal.error({ title: "提示信息", content: "编辑数据加载失败!!!" });
                            break;
                    }
                }
            );
        },
        //获取当前页码
        getPageNumber(pageIndex) {
            this.searchModel.PageNumber = pageIndex;
            this.getPageData();
        },
        //获取当前分页大小
        getPageSize(pageSize) {
            this.searchModel.PageSize = pageSize;
            this.getPageData();
        },
        //获取this.datas: {},//table数据对象
        getPageData() {
            var self = this;
            var user = this.GetlocaStorage("CSuserinfo");
            this.searchModel.AreaCode = user.AreaCode;
            self.$http.post('Report/PostPageList', this.searchModel).then(function (res) {
                if (res.data.status === 1) {
                    self.datas = res.data;
                }
                else {
                    self.$Modal.error({ title: '提示信息', content: res.data.message });
                }
            });
        },
        //编辑获取对象传入id
        editInfo(id, reportCode) {//编辑
            var self = this;
            this.$http.get("Report", { params: { id: id, reportCode: reportCode } }).then(//获取数据编辑项的值
                function (res) {
                    switch (res.data.list.status) {
                        case 1:
                            self.dataModel = res.data.list.model;
                            //self.initTab(self, res.data.list.model);
                            self.modalShow();
                            //self.selectTabName = self.TabTitleList[0].SortCode;
                            break;
                        case 0:
                            self.$Modal.error({ title: "提示信息", content: "编辑数据加载失败!!!" });
                            break;
                        case -1:
                            self.$Modal.error({ title: "提示信息", content: "编辑数据加载失败!!!" });
                            break;
                    }
                }
            );
        },
        initTab(self, datas) {
            self.TabTitleList = [];
            for (var i = 0; i < datas.length; i++) {
                if (!self.checkTab(datas[i].SortCode, self)) {
                    var item = new Object();
                    item.SortCode = datas[i].SortCode;
                    item.SortName = datas[i].SortName;
                    item.list = [];
                    for (var j = 0; j < datas.length; j++) {
                        if (datas[j].SortCode == datas[i].SortCode) {
                            if (!self.checkItem(item.list, datas[j].ItemCode)) {
                                item.list.push(datas[j]);
                            }
                        }
                    }
                    self.TabTitleList.push(item);
                }
            }
            return self.TabTitleList;
        },
        checkTab(SortCode, self) {
            var res = false;
            for (var i = 0; i < self.TabTitleList.length; i++) {
                if (self.TabTitleList[i].SortCode == SortCode) {
                    res = true;
                }
            }
            return res;
        },
        checkItem(datas, ItemCode) {
            var res = false;
            for (var i = 0; i < datas.length; i++) {
                if (datas[i].ItemCode == ItemCode) {
                    res = true;
                }
            }
            return res;
        },
        //保存方法
        save() {
            var self = this;
            //var list = this.findItemList(this.selectTabName);
            this.$http.put('MulProdInfoChart', self.dataModel).then(
                function (res) {
                    if (res.data.status == 1) {
                        self.getPageData();//读取分页数据
                        //self.modalHide();//关闭modal
                        self.$Notice.success({ title: '保存成功！', desc: false });
                    }
                    else {
                        self.$Modal.warning({ title: "提示信息", content: "更新失败,请与管理员联系!" });
                    }
                });
        },
        findItemList(tabname) {
            var list = [];
            for (var i = 0; i < this.TabTitleList.length; i++) {
                if (this.TabTitleList[i].SortCode == tabname) {
                    list = this.TabTitleList[i].list;
                    break;
                }
            }
            return list;
        },
        //编辑框打开
        modalShow() {
            this.showType = true;
        },
        //编辑框关闭
        modalHide() {
            this.showType = false;
        },
        //取消方法
        cancel() {
            this.showType = false;//关闭modal
            this.TabTitleList = [];
        },
        //重置model
        restModel(modelname) {
            this.$refs[modelname].resetFields();//重置model
        }
    },
    //创建Vue页面方法
    created: function () {
        //创业Vue前调用获取this.datas: {},//table数据对象
        this.getPageData();
    },
    watch: {
        //需要监听的在此处新增监听对象
    }
}
</script>
